package com.songlanyun.modules.distributionconfig.controller.admin;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.songlanyun.common.annotation.SysLog;
import com.songlanyun.modules.distributionconfig.model.DistributionShopProxyConfigDTO;
import com.songlanyun.modules.user.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.songlanyun.modules.distributionconfig.entity.DistributionShopProxyConfig;
import com.songlanyun.modules.distributionconfig.service.DistributionShopProxyConfigService;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.common.utils.R;



/**
 * 平台商家代销商品小程序分佣配置
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2020-12-22 11:43:24
 */
@RestController
@RequestMapping("admin/shopproxyconfig")
public class DistributionShopProxyConfigAdminController extends AbstractController {
    @Autowired
    private DistributionShopProxyConfigService distributionShopProxyConfigService;




    /**
     * 查看平台商家代销商品小程序分佣配置
     */
    @RequestMapping("/info")
    //@RequiresPermissions("distributionconfig:distributionshopproxyconfig:info")
    public R info(){
		DistributionShopProxyConfig distributionShopProxyConfig = distributionShopProxyConfigService.getByShop(getShopId(true));
        return R.ok().put("data", distributionShopProxyConfig);
    }

    /**
     * 保存平台商家代销商品小程序分佣配置
     */
    @SysLog("保存平台商家代销商品小程序分佣配置")
    @RequestMapping("/set")
    //@RequiresPermissions("distributionconfig:distributionshopproxyconfig:save")
    public R set(@RequestBody DistributionShopProxyConfigDTO dto){
        DistributionShopProxyConfig distributionShopProxyConfig = distributionShopProxyConfigService.set(getShopId(true),dto);
        return R.ok().put("data", distributionShopProxyConfig);
    }

}
